﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using BaseData.Common;
using BaseData.UI;
using TaxData.SysConfig;
using TaxEntity.SysConfig;
using TaxEntity.User;

namespace TaxBiz.SysConfig
{
    /// <summary>
    /// 部门逻辑层
    /// </summary>
    public class DepartmentBiz
    {
        private DepartmentData dmd = new DepartmentData();

        /// <summary>
        /// 获取部门信息实体
        /// </summary>
        public DepartmentEntity GetEntityById(int ID)
        {
            DepartmentEntity model = dmd.GetEntityById(ID);
            return model;
        }

        /// <summary>
        /// 删除部门
        /// </summary>
        public bool Delete(int ID, UserEntity optUser)
        {
            bool isSucc = dmd.Delete(ID);
            return isSucc;
        }

        /// <summary>
        /// 获取部门列表
        /// </summary>
        public DataTable GetList(string strWhere, int pageSize, int page, ref int allCount)
        {
            DataTable dt = dmd.GetList(strWhere, pageSize, page, ref allCount);
            return dt;
        }

        /// <summary>
        /// 获取部门列表
        /// </summary>
        public DataTable GetList()
        {
            DataTable dt = dmd.GetList();
            return dt;
        }

        /// <summary>
        /// 增加部门
        /// </summary>
        /// <param name="model">部门信息实体</param>
        /// <param name="optUser">操作人</param>
        /// <returns>成功部门编号,失败返回0</returns>
        public int Add(DepartmentEntity model, UserEntity optUser)
        {
            int id = dmd.Add(model);
            return id;
        }

        /// <summary>
        /// 修改部门信息
        /// </summary>
        /// <param name="model">修改部门</param>
        /// <param name="optUser">操作人</param>
        /// <returns>操作结果</returns>
        public bool Update(DepartmentEntity model, UserEntity optUser)
        {
            bool isSucc = dmd.Update(model);
            return isSucc;
        }
    }
}
